<?php
/**
 * User.php
 *
 * @category    Madoqua
 * @package     Module
 * @subpackage  BlogAdmin
 */

/** base class */
require_once 'Madoqua/Form.php';

/** htmlentities filter */
require_once 'Zend/Filter/HtmlEntities.php';

/**
 * BlogAdmin_User_User
 *
 * form for users
 *
 * @category    Madoqua
 * @package     Module
 * @subpackage  BlogAdmin
 */
class BlogAdmin_User_User extends Madoqua_Form
{
    /**
     * no html filter
     *
     * @var Zend_Filter_HtmlEntities
     */
    protected $_noHtml;

    /**
     * constructor
     */
    public function __construct() {
        parent::__construct();

        $this->_noHtml = new Zend_Filter_HtmlEntities(array(
                'quotestyle' => ENT_COMPAT,
                'charset'    => 'UTF-8'
            )
        );
        //htmlentities filter for non-html fields

        $this->addElement('text', 'username', array(
            'label' => 'Username',
            'required' => true,
            'validators' => array(
                array('StringLength', 255, 3)
            ),
            'filters' => array(
                $this->_noHtml
            )
        ));

        $this->addElement('text', 'openid', array(
            'label' => 'Open ID',
            'required' => false,
            'validators' => array(
                array('StringLength', 255, 3)
            ),
            'filters' => array(
                $this->_noHtml
            )
        ));

        $this->addElement('submit', 's', array(
            'label' => 'Submit'
        ));

    }
}